package com.miku.blog.controller;

import com.miku.blog.annotation.SystemLog;
import com.miku.blog.domain.Message;
import com.miku.blog.domain.dto.MessageDTO;
import com.miku.blog.domain.pojo.ResponseResult;
import com.miku.blog.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shkstart
 * @create ${}YEAR-06-09 0:31
 */
@Api(tags = "Blog[留言]")
@RestController
public class MessageController {

    @Autowired
    private MessageService messageService;


    @SystemLog(notes = "获取留言列表{前台博客系统}")
    @ApiOperation(value = "获取留言列表接口",notes = "获取留言列表相关数据进行展示")
    @GetMapping("/messages")
    public ResponseResult getMessageList(){
        return messageService.getMessageList();
    }

    @SystemLog(notes = "添加留言数据{前台博客系统}")
    @ApiOperation(value = "添加留言接口",notes = "添加留言数据")
    @PostMapping("/messages")
    public ResponseResult addMessage(@RequestBody MessageDTO messageDTO)
    {
        return messageService.addMessage(messageDTO);
    }

}
